package celiasoft.itasalib.filegatherer;

import java.io.File;

import android.content.Context;
import android.util.Log;

public class FileSystemHelper {
	
	private final static String TAG = "itasalib.FileSystemHelper";

	/**
     * Gets a path to the cache folder.
     * 
     * This caching folder stores a cache for the currently running application. The folder
     * is created on external storage (without access control, thus paths to files can be shared
     * across applications) in a space private to the application. Android will automatically
     * delete this storage space when the application is deleted, thus freeing the cache.
     * 
     * @param context Context of the running application.
     * @return Path to the cache folder or null if not available.
     */
    public static String getApplicationCachePath(Context context){
            File extDir = context.getExternalFilesDir(null);
            if(extDir == null){
                    Log.e(TAG, "Cannot access external files directory (unmounted or unavailable).");
                    return null;
            }
            
            String cachePath = extDir.getAbsolutePath() + "/openboxware/cache";
            
            return cachePath;
    }
    
}
